﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TimeTravel.XnaLibrary
{
	public struct GameMessages
	{
		public static readonly string StillPlaying = "Battle in progress, be patient";
		public static readonly string Player1Turn = "Currently Player 2 wins,\nbut Player 1 can change the tides of battle!";
		public static readonly string Player2Turn = "Currently Player 1 wins,\nbut Player 2 can change the tides of battle!";
		public static readonly string Player1Wins= "Player 1 wins the game!";
		public static readonly string Player2Wins= "Player 2 wins the game!";
		
		/// <summary>
		/// Returns a string used for displaying error for lack of sufficient mana for the specified time manipulation.
		/// </summary>
		/// <param name="neededMana">The mana needed to perform the specified manipulation.</param>
		/// <param name="manaInStock">The current mana the player possesses.</param>
		/// <param name="timeManipulation">The type of the manipulation</param>
		public static string GetNotEnoughManaMessage(int neededMana, int manaInStock, TimeManipulationType timeManipulation)
		{
			switch (timeManipulation)
			{
				case TimeManipulationType.ForwardUnit :
					return "You cannot afford to send\nthis unit that many turns in the future.\n" +	 
						GetNotEnoughManaMessage(neededMana, manaInStock);
				case TimeManipulationType.RewindUnit:
					return "You cannot afford to send\nthis unit that many turns in the past.\n" +	 
						GetNotEnoughManaMessage(neededMana, manaInStock);
				case TimeManipulationType.KillEnemy:
					return "You cannot afford to\nkill an enemy unit.\n"+
						GetNotEnoughManaMessage(neededMana, manaInStock);
				case TimeManipulationType.Butterfly:
					return "You cannot afford to\nuse the butterfly effect.\n" +
						GetNotEnoughManaMessage(neededMana, manaInStock);
				default:
					throw new ArgumentException("You didnt provide a correct time manipulation");
			}
		}

		/// <summary>
		/// Returns the default string for lack of sufficient mana.
		/// </summary>
		/// <param name="neededMana">The mana needed to perform the specified manipulation.</param>
		/// <param name="manaInStock">The current mana the player possesses.</param>
		public static string GetNotEnoughManaMessage(int neededMana, int manaInStock)
		{
			return string.Format("This action requires {0} mana.\nYou only have {1} mana", neededMana, manaInStock);
		}
	}

	public enum TimeManipulationType 
	{
		RewindUnit, ForwardUnit, KillEnemy, Butterfly
	}
}
